package com.expdatacloud.controller.bas;

import com.expdatacloud.service.SkuService;
import com.expdatacloud.vo.OverdueMaterialVo;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author jie
 * @date 2020/5/18 -18:47
 */
@Controller
@RequestMapping("/sku")
public class SkuController {

    @Autowired
    private SkuService skuService;

    @PostMapping(value = "/update", produces = "application/json;charset=UTF-8")
    @ResponseBody
    public void updateDefault1(@RequestBody Object jsonStr) {
        ObjectMapper mapper = new ObjectMapper();
        OverdueMaterialVo overdueMaterialVo = mapper.convertValue(jsonStr, OverdueMaterialVo.class);
        skuService.update(overdueMaterialVo.getReCheckDate(), overdueMaterialVo.getSku(), overdueMaterialVo.getStorerkey());
    }
}
